#include <iostream>
using namespace std;
#include <vector>

int main(){
    vector<int> nums;
    nums.push_back(1);
    nums.push_back(2);
    nums.push_back(3);
    int bit[3]={0,0,0};
        for(int i = 0; i < 3; ++i){
            int tmp=nums[i];
            while(tmp){
                bit[i]++;
                tmp/=2;
            }
        }
        int res = 0;
        for (int i = 0; i < 3; ++i){
            int tmp = nums[i];
            int rec;
            for(int j=0; j<2; ++j){
                tmp = tmp<<bit[(i+j+1)%3];
            }
            rec = tmp;
            for (int j = -1; j < 2; j+=2){
                tmp = rec;
                int f = 0;
                if (j == -1) f = 1;
                else f = -1;
                tmp += nums[(i+j+3)%3]<<bit[(i+f+3)%3];
                
                tmp += nums[(i+f+3)%3];
                cout << tmp<<endl;
                res = max(res,tmp);
            }
        }
    cout << res;
}